﻿/* 
 * Copyright 2012 Pieter Roggemans
 *
 * This file is part of OWNMonitor.
 *
 * OWNMonitor is free software: you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation, version 3 of the License.
 *
 * OWNMonitor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with OWNMonitor. 
 * If not, see http://www.gnu.org/licenses/.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using BTicino.BtCommLib.Domain.HighLevel;

namespace OWNLib
{
    public class OWNLogger
    {
        public BindingList<OWNLogLine> Logging { get; set; }

        public OWNLogger()
        {
            Logging = new BindingList<OWNLogLine>();
        }
    }

    public class OWNLogLine
    {
        public DateTime Logtime { get; set; }
        public string Direction { get; set; }
        public string Who { get; set; }
        public string Where { get; set; }
        public string What { get; set; }
        public string Dimension { get; set; }
        public string Remark { get; set; }

        public OWNLogLine(OWNMessage.MsgEventStatus eventStatus)
        {
            Logtime = DateTime.Now;
            Direction = eventStatus.Direction.ToString();
            Who = eventStatus.Who.ToString();
            Where = eventStatus.Where.ToString();
            What = eventStatus.What.ToString();
            Dimension = "";
            Remark = "";
        }

        public OWNLogLine(OWNMessage.MsgEventStatusDimension eventStatusDim)
        {
            Logtime = DateTime.Now;
            Direction = eventStatusDim.Direction.ToString();
            Who = eventStatusDim.Who.ToString();
            Where = eventStatusDim.Where.ToString();
            Dimension = eventStatusDim.Dimension.ToString();
            Remark = "";
        }

        public OWNLogLine(string remark)
        {
            Logtime = DateTime.Now;
            Direction = "-";
            Who = "-";
            Where = "-";
            Dimension = "-";
            Remark = remark;
        }
    }
}
